<template>
    <div id="wrapper">
        <projectform
            :form="itemFormData"
            :mode="mode"
            :canEdit="!readonly"
            :isadd="true"
        ></projectform>
    </div>
</template>
<script>
import projectForm from './components/projectForm.vue';

export default {
    components: {
        projectform: projectForm,
    },
    data() {
        return {
            BACKEND_API: process.env.VUE_APP_PROJECT_REQUEST_HOST,
            readonly: this.$route.name === 'view',
            mode: this.$route.name,
            itemFormData: {
                canEditProjectDirector: true,
                enableSubProjectName: true,
                oldProjectPeriod: '',
                pastMonths: [],
                nextMonths: [],
                allMonths: [],
                form_id: null,
                form_form_id: null,
                labourCost: [],
                application_type: 0,
                housing_fund_rate: 25,
                group_salary_cost: {},
                constants: {
                    domestic_accommodation: 250,
                    domestic_transportation: 0,
                    domestic_meals: 150,
                    foreign_accommodation: 500,
                    foreign_transportation: 0,
                    foreign_meals: 250,
                    visa: 800,
                    depreciation_rent: 1200,
                    depreciation_renovation: 0,
                    depreciation_house: 0,
                    depreciation_computer: 5500,
                },
                file_list: [],
                special_approval_list: [],
                attachments: [],
                special_approval_attachments: [],
                currency_id: '',
                est_market_size_over_20_million: '1',
                est_market_size_over_20_million_list: [
                    {
                        label: '是',
                        value: '0',
                    },
                    {
                        label: '否',
                        value: '1',
                    },
                ],
                currency: '',
                created_at: '',
                changed_at: '',
                income_check_method: '',
                est_contract_signing_date: '',
                entire_subcontract: false,
                security_level: '',
                security_level_list: [
                    {
                        label: 'A',
                        value: '0',
                    },
                    {
                        label: 'B',
                        value: '1',
                    },
                    {
                        label: 'C',
                        value: '2',
                    },
                ],
                billing_period: '',
                sales: '',
                labourOtherCost: [{ input: [] }],
                workhour_status: '',
                // 项目
                init_project_start_date: '',
                init_project_end_date: '',
                project_start_date: '',
                project_end_date: '',
                project_period: '',
                old_project_period: '',
                project_changed_start_date: '',
                project_changed_end_date: '',
                project_name: '',
                project_id:'',
                project_director: '',
                project_director_id: '',
                project_manager: '',
                project_manager_id: '',
                project_level: '',
                project_level_list: [
                    {
                        label: 'A',
                        value: '0',
                    },
                    {
                        label: 'B',
                        value: '1',
                    },
                    {
                        label: 'C',
                        value: '2',
                    },
                    {
                        label: 'D',
                        value: '3',
                    },
                ],
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                desc: '',
                special_approval: '',
                sales_id: '0',
                corporation: '',
                corporation_id: '',
                project_summary: '',
                project_change_reason: '',
                is_pre_dev: false,
                // 业务
                business_type: '',
                business_sub_type: '',
                // 软件
                software_platform: '',
                software_version: '',
                // 硬件
                hardware_platform: '',
                hardware_version: '',
                // 客户
                region: '',
                customer_full_name: '',
                customer_id: '',
                customer_abrv_name: '',
                customer_region: '',
                customer_category: '',
                customer_level: '',
                customer_region_id: '',
                is_new_customer: '1',
                is_new_market: '1',
                is_new_direction: '1',
                customerMsg: [
                    {
                        clause_Small: '',
                        clause_Large: '',
                        investment: '',
                    },
                ],
                // 事业部/事业群
                business_department_id: '',
                business_department: '',
                business_department_manager: '',
                business_group: '',
                business_group_id: '',
                business_group_manager: '',
                deal_id: '',
                // 主交付/产品中心
                product: '',
                // 产品
                product_category: '',
                product_sub_category: '',
                // 预研
                pre_project_name:'',
                pre_project_id:'',
                pre_man_month:'',
                pre_cost:'',
                // 其它
                process_compliance: '',
                defect_density: '',
                one_time_release_success_rate: '',
                hardware_revision_count: '',
                // 人力投入
                manPowerColumns: [
                    // { field: 'id', title: '#', width: 100 },
                    {
                        field: 'implement_department',
                        title: '实施部门',
                        width: 250,
                    },
                    { field: 'labour_type', title: '人员类型', width: 150 },
                    { field: 'role', title: '角色', width: 150 },
                    // { field: 'module', title: '模块', width: 150 },
                    // { field: 'sub_module', title: '子模块', width: 150 },
                    { field: 'k', title: '平均薪资系数', width: 120 },
                    { field: 'man_month', title: '工数(人月)', width: 100 },
                ],
                manPowerOutSourcingColumns: [
                    // { field: 'id', title: '#', width: 100 },
                    {
                        field: 'implement_department',
                        title: '实施部门',
                        width: 250,
                    },
                    { field: 'labour_type', title: '人员类型', width: 150 },
                    { field: 'role', title: '角色', width: 150 },
                    // { field: 'module', title: '模块', width: 150 },
                    // { field: 'sub_module', title: '子模块', width: 150 },
                    { field: 'avg_salary', title: '平均薪资', width: 120 },
                    { field: 'man_month', title: '工数(人月)', width: 100 },
                ],
                // 收入比例
                incomeDistributionColumns: [
                    // { field: 'id', title: '#', width: 40 },
                    {
                        field: 'implement_department',
                        title: '实施部门',
                        width: 250,
                    },
                    { field: 'percentage', title: '收入比例', width: 150 },
                    {
                        field: 'income',
                        title: '实施部门收入(人民币)',
                        width: 200,
                    },
                ],
                stagePlanColumns: [
                    {
                        field: 'milestone',
                        type: 'input',
                        title: '合同中约定里程碑节点',
                        width: 200,
                    },
                    {
                        field: 'deliver_date',
                        type: 'date',
                        title: '计划交付时间',
                        width: 200,
                    },
                    {
                        field: 'is_check_node',
                        type: 'select',
                        title: '是否为收款节点',
                        width: 150,
                        options: [
                            { label: '是', value: true },
                            { label: '否', value: false },
                        ],
                    },
                    {
                        field: 'amount',
                        type: 'input',
                        title: '不含税金额（RMB）',
                        width: 150,
                    },
                    {
                        field: 'terms',
                        type: 'textarea',
                        title: '收款条款约定',
                        width: 200,
                    },
                    {
                        field: 'stage_name',
                        type: 'select',
                        title: '阶段点名称',
                        width: 150,
                        options: [
                            { label: 'TG0(启动阶段)', value: '0' },
                            { label: 'TG1(计划阶段)', value: '1' },
                            { label: 'TG2(需求阶段)', value: '2' },
                            { label: 'TG3.1(设计阶段)', value: '3' },
                            { label: 'TG3.2(编码实现)', value: '4' },
                            { label: 'TG4.1(Feature Complete)', value: '5' },
                            { label: 'TG4.2(ST实施)', value: '6' },
                            { label: 'TG5(交付)', value: '7' },
                            { label: 'TG6(结项阶段）', value: '8' },
                            { label: 'TG0(启动阶段)', value: '9' },
                            { label: 'TG1(计划阶段)', value: '10' },
                            { label: 'TG2(需求阶段)', value: '11' },
                            { label: 'TG3(设计阶段)', value: '12' },
                            { label: 'TG4.1(EVT)', value: '13' },
                            { label: 'TG4.2(DVT)', value: '14' },
                            { label: 'TG5(PVT)', value: '15' },
                            { label: 'TG6(MP）', value: '16' },
                        ],
                    },
                    {
                        field: 'stage_start',
                        type: 'date',
                        title: '阶段开始时间',
                        width: 200,
                    },
                    {
                        field: 'stage_end',
                        type: 'date',
                        title: '阶段结束时间',
                        width: 200,
                    },
                    {
                        field: 'est_input_man_month',
                        type: 'input',
                        title: '本阶段点的预计投入人月',
                        width: 200,
                    },
                    {
                        field: 'est_input_cost',
                        type: 'input',
                        title: '本阶段点的预计投入成本（RMB）',
                        width: 250,
                    },
                ],
                projectIncome: [
                    {
                        field: 'nre_offer_man_month',
                        title: 'NRE报价人月数',
                        input: [],
                        type: 'input',
                        input_type: 2,
                    },
                    {
                        field: 'nre_offer_per_unit',
                        title: 'NRE单位报价(不含税原币)',
                        input: [],
                        value: 0,
                        type: 'input',
                        input_type: 2,
                    },
                    {
                        field: 'nre_income',
                        title: 'NRE收入(不含税原币)',
                        input: [],
                        type: 'span',
                        input_type: 1,
                    },
                    {
                        field: 'nre_income_rmb',
                        title: 'NRE收入(不含税RMB)',
                        input: [],
                        type: 'span',
                        input_type: 0,
                    },
                    {
                        field: 'royalty',
                        title: 'Royalty(不含税原币)',
                        input: [],
                        type: 'input',
                        input_type: 1,
                    },
                    {
                        field: 'royalty_rmb',
                        title: 'Royalty(不含税RMB)',
                        input: [],
                        type: 'span',
                        input_type: 0,
                    },
                    {
                        field: 'training',
                        title: '培训服务收入(不含税原币)',
                        input: [],
                        type: 'input',
                        input_type: 1,
                    },
                    {
                        field: 'training_rmb',
                        title: '培训服务收入(不含税RMB)',
                        input: [],
                        type: 'span',
                        input_type: 0,
                    },
                    {
                        field: 'internal_outsourcing',
                        title: '集团内外包收入(不含税原币)',
                        input: [],
                        type: 'input',
                        input_type: 1,
                    },
                    {
                        field: 'internal_outsourcing_rmb',
                        title: '集团内外包收入(不含税RMB)',
                        input: [],
                        type: 'span',
                        input_type: 0,
                    },
                    {
                        field: 'other',
                        title: '其他业务收入(不含税原币)',
                        input: [],
                        type: 'input',
                        input_type: 1,
                    },
                    {
                        field: 'other_rmb',
                        title: '其他业务收入(不含税RMB)',
                        input: [],
                        type: 'span',
                        input_type: 0,
                    },
                ],
                purchaseCost: [
                    {
                        field: 'raw_materials',
                        title: '原材料',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'mobile_phones',
                        title: '研发手机',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'tablets',
                        title: '研发用平板',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'sim_cards',
                        title: 'SIM及充值',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'accessories',
                        title: '研发用配件',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'other_purchase',
                        title: '其他直接采购成本',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                ],
                productionCost: [
                    {
                        field: 'processing',
                        title: '加工费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'modeling',
                        title: '模具费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'manufacturing',
                        title: '制造费用',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'other_production',
                        title: '其他生产成本',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                ],
                outsourcingProjectCost: [
                    {
                        field: 'dev_service',
                        title: '技术开发服务费',
                        input: [],
                        type: 'span',
                        input_type: 4,
                        placeholder: '',
                    },
                    {
                        field: 'pm_service',
                        title: '项目管理服务费',
                        input: [],
                        type: 'span',
                        input_type: 4,
                        placeholder: '',
                    },
                    {
                        field: 'test_service',
                        title: '测试服务费',
                        input: [],
                        type: 'span',
                        input_type: 4,
                        placeholder: '',
                    },
                    {
                        field: 'outsourcing_design_service',
                        title: '设计服务费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                        placeholder: '',
                    },
                    {
                        field: 'outsourcing_certification_service',
                        title: '认证费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                        placeholder: '',
                    },
                    {
                        field: 'internal_outsourcing',
                        title: '集团内外包成本',
                        input: [],
                        type: 'input',
                        input_type: 4,
                        department: '',
                        placeholder: '外包部门',
                    },
                    {
                        field: 'outsourcing_provider_1',
                        title: '项目外包供应商-1',
                        input: [],
                        type: 'input',
                        provider: '',
                        input_type: 4,
                        placeholder: '供应商名',
                    },
                    {
                        field: 'outsourcing_provider_2',
                        title: '项目外包供应商-2',
                        input: [],
                        type: 'input',
                        provider: '',
                        input_type: 4,
                        placeholder: '供应商名',
                    },
                    {
                        field: 'outsourcing_provider_3',
                        title: '项目外包供应商-3',
                        input: [],
                        type: 'input',
                        provider: '',
                        input_type: 4,
                        placeholder: '供应商名',
                    },
                ],
                domesticTravel: [
                    {
                        field: 'domestic_man_time',
                        title: '国内出差人次(往返为1次)',
                        input: [],
                        type: 'input',
                        hint: '往返为一次',
                    },
                    {
                        field: 'domestic_days',
                        title: '国内出差天数(人天数)',
                        input: [],
                        type: 'input',
                        hint: '人天数',
                    },
                    {
                        field: 'domestic_bus',
                        title: '国内巴士的费',
                        input: [],
                        type: 'input',
                        hint: '-',
                        input_type: 4,
                    },
                    {
                        field: 'domestic_other',
                        title: '国内其它出差费用',
                        input: [],
                        type: 'input',
                        hint: '-',
                        input_type: 4,
                    },
                ],
                foreignTravel: [
                    {
                        field: 'foreign_man_time',
                        title: '国际出差人次(往返为1次)',
                        input: [],
                        type: 'input',
                        hint: '往返为一次',
                    },
                    {
                        field: 'foreign_days',
                        title: '国际出差天数(人天数)',
                        input: [],
                        type: 'input',
                        hint: '人天数',
                    },
                    {
                        field: 'foreign_bus',
                        title: '国际汽车租金或巴士的士费',
                        input: [],
                        type: 'input',
                        hint: '-',
                        input_type: 4,
                    },
                    {
                        field: 'foreign_other',
                        title: '国际其它出差费用',
                        input: [],
                        type: 'input',
                        hint: '-',
                        input_type: 4,
                    },
                ],
                rent: [
                    {
                        field: 'device',
                        title: '设备租赁',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'car',
                        title: '租车费/汽车耗费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'house',
                        title: '房屋租赁',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                ],
                assets: [
                    {
                        field: 'server',
                        title: '服务器',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'debug',
                        title: '调试仪器',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'dev',
                        title: '研发设备',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'test',
                        title: '测试设备',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                ],
                immaterial: [
                    {
                        field: 'software',
                        title: '软件',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        field: 'licence',
                        title: '软件许可权',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                ],
                it_cost: [
                    {
                        summary: 0,
                        field: 'cloud',
                        title: '数据交流/云服务',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'domain_name',
                        title: '公司域名注册费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'it_consumables',
                        title: 'IT消耗品',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'network_bandwidth',
                        title: '网络带宽费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'hosting',
                        title: '主机托管',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                ],
                depreciation: [
                    //折旧
                    {
                        summary: 0,
                        field: 'rent',
                        title: '房租及物业管理费摊销',
                        input: [],
                        type: 'span',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'computer',
                        title: '电脑折旧',
                        input: [],
                        type: 'span',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'renovation',
                        title: '装修费摊销(人/月)',
                        input: [],
                        type: 'span',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'house',
                        title: '房屋建筑物折旧(人/月)',
                        input: [],
                        type: 'span',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'fixed_assets',
                        title: '固定资产折旧',
                        input: [],
                        type: 'span',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'intangible_assets',
                        title: '无形资产摊销',
                        input: [],
                        type: 'span',
                        input_type: 4,
                    },
                ],
                operation: [
                    {
                        summary: 0,
                        field: 'public_relation',
                        title: '招待公关费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'communication',
                        title: '通讯费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'dept_training',
                        title: '部门培训费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'office',
                        title: '办公费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'mail',
                        title: '邮运及保险费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'pro',
                        title: '专业费用',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'consultation',
                        title: '咨询服务',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                    {
                        summary: 0,
                        field: 'conference',
                        title: '会议费',
                        input: [],
                        type: 'input',
                        input_type: 4,
                    },
                ],
                // 工数历史
                historyManPowerInput: [
                    { input: [], rowName: '实际投入(人月)' },
                    { input_type: 4, input: [], rowName: '实际成本(RMB)' },
                ],
                historyManPowerOutSourcingInput: [
                    { input: [], rowName: '实际投入(人月)' },
                    { input_type: 4, input: [], rowName: '实际成本(RMB)' },
                ],
                // 工数预测
                manPowerInput: [],
                manPowerOutSourcingInput: [],
                // 收入拆分
                incomeDistribution: [],
                incomeDistributionSubmit: {},
                // 采购成本推送到OA
                purchaseCostNum: '',
                // 外包成本推送到OA
                outsourcingProjectCostNum: '',
                // 阶段点计划
                stagePlans: [],
                // 自研量产出货
                taxRate: 0,
                unitCost: 0,
                unitPriceRaw: 0,
                hardwareProducts: [
                    {
                        field: 'unitCost',
                        title: '单机成本(按采购部提供的含税价计算)',
                        input: [],
                        type: 'input',
                        input_type: 2,
                    },
                    {
                        field: 'unitPriceRaw',
                        title: '单机售价(含税原币)',
                        input: [],
                        type: 'input',
                        input_type: 2,
                    },
                    {
                        field: 'max_possible_sales',
                        title: '最大可能销售量',
                        input: [],
                        type: 'input',
                        input_type: 2,
                    },
                    {
                        field: 'max_possible_cost',
                        title: '最大可能成本',
                        input: [],
                        type: 'span',
                    },
                    {
                        field: 'max_possible_income_raw',
                        title: '最大可能销售收入(不含税原币)',
                        input: [],
                        type: 'span',
                    },
                    {
                        field: 'max_possible_income_rmb',
                        title: '最大可能销售收入(不含税RMB)',
                        input: [],
                        type: 'span',
                    },
                    {
                        field: 'batch_production_income',
                        title: '含量产预测的预计总收入(原币)',
                        type: 'batch_production',
                    },
                    {
                        field: 'batch_production_income_rmb',
                        title: '含量产预测的预计总收入(人民币)',
                        type: 'batch_production',
                    },
                    {
                        field: 'batch_production_investment_rmb',
                        title: '含量产预测的预计总投入(人民币)',
                        type: 'batch_production',
                    },
                    {
                        field: 'batch_production_benefit',
                        title: '含量产预测的预计毛利(人民币)',
                        type: 'batch_production',
                    },
                    {
                        field: 'batch_production_interest_rate',
                        title: '含量产预测的预计毛利率',
                        type: 'batch_production',
                    },
                    {
                        field: 'batch_production_interest_rate_comprehensive',
                        title: '含量产预测的综合毛利率',
                        type: 'batch_production',
                    },
                ],
            },
        };
    },
    created() {
        localStorage.clear();
    },
    mounted() {
        this.$nextTick(() => {});
        localStorage.clear();
    },
    methods: {},
};
</script>
